package com.zzh.ideas.web.aspect;

import com.zzh.ideas.web.annotation.annotations.TestAnnotation;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

/**
 * description: <br>
 * createTime: 2019/8/2610:43 <br>
 *
 * @author zzh
 */
@Component
@Aspect
@Slf4j
public class TestControllerAspect {

    public TestControllerAspect() {
        System.out.println("TestControllerAspect construct");
    }


//    @Around(value = "@annotation(org.springframework.web.bind.annotation.PostMapping)" +
//            "|| @annotation(org.springframework.web.bind.annotation.RequestMapping)" +
//            "|| @annotation(org.springframework.web.bind.annotation.GetMapping)")
//    @Around(value="@annotation(com.zzh.ideas.web.annotation.annotations.TestAnnotation)")
//    public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
    @Around(value="@annotation(testAnnotation)")
    public Object around(ProceedingJoinPoint joinPoint, TestAnnotation testAnnotation) throws Throwable {
        System.out.println("TestControllerAspect bebin");
        Object result = joinPoint.proceed();
        System.out.println("TestControllerAspect end");
        return result;
    }
}
